/*
 * Created on Nov 18, 2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.vectrics.recruiter.user;

import org.apache.log4j.Logger;
import org.vectrics.common.db.Auditable;
import org.vectrics.common.db.EventGeneratingEntity;
import org.vectrics.common.db.OwnedObject;
import org.vectrics.common.db.RecordObject;
import org.vectrics.common.util.DateUtil;
import org.vectrics.domain.Domain;
import org.vectrics.recruiter.job.Job;
import org.vectrics.recruiter.user.Interview;
import java.io.Serializable;
import java.util.Date;
import org.vectrics.user.Person;
import org.vectrics.user.PersonEncounter;
import org.vectrics.user.PersonEncounterStatusType;

public class Interview implements RecordObject, OwnedObject, Auditable, 
		EventGeneratingEntity, Serializable, PersonEncounter {

	private static final long serialVersionUID = -7179765251150535690L;
	
	private transient static Logger log = Logger.getLogger(Interview.class);
	public final static String OBJECT_TYPE = "Interview";
	
	public final static String RESULT_UNDECIDED = "undecided";
	public final static String RESULT_REJECTED = "rejected";
	public final static String RESULT_FURTHER_INTERVIEW = "further";
	public final static String RESULT_ACCEPTED = "accepted";
	public final static String RESULT_POSTPONED = "postponed";
	
	private Long id = null;
	private Person person = null;
	private Job job = null;
	private PersonEncounterStatusType statusType = null;
	private InterviewResultType resultType = null;
	private Date dateStart = new Date();
	private Date endDate = new Date(dateStart.getTime() + DateUtil.MILLIS_IN_A_HOUR);
	private InterviewInstance interviewInstance = null;
	private String description = null;
	private String notes = null;
	private String followUp = null;
	private String result = null;
	private boolean voided = false;
	private String referenceId = null;
	private Domain domain = null;
	private Person createdBy = null;
	private Date createdDate = null;
	private Person lastModifiedBy = null;
	private Date lastModifiedDate = null;
	private Person leadPerson = null;
	
	public String getTypeDescription() {
		return("Evaluation");
	}
	
	public PersonEncounterStatusType getEncounterStatus() {
	    return(this.getStatusType());
	}
	
	public void copy(Interview interview) {
		this.setDateStart(interview.getDateStart());
		this.setDateEnd(interview.getDateEnd());
		this.setDescription(interview.getDescription());
		this.setFollowUp(interview.getFollowUp());
		this.setId(interview.getId());
		this.setLeadPerson(interview.getLeadPerson());
		this.setJob(interview.getJob());
		this.setNotes(interview.getNotes());
		this.setResult(interview.getResult());
		this.setStatusType(interview.getStatusType());
		this.setPerson(interview.getPerson());	
	}
		
	public boolean logEntityChanges() {
		return(false);
	}
	
	/**
	 * @return
	 */
	public Date getDateStart() {
		return dateStart;
	}

	public void setDateStart(Date date) {
		this.dateStart = date;
	}
	
	public Date getDateEnd() {
		return endDate;
	}

	public void setDateEnd(Date date) {
		this.endDate = date;
	}
	
	public InterviewInstance getInterviewInstance() {
		return interviewInstance;
	}

	public void setInterviewInstance(InterviewInstance interviewInstance) {
		this.interviewInstance = interviewInstance;
	}

	/**
	 * @return
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return
	 */
	public String getFollowUp() {
		return followUp;
	}

	/**
	 * @param followUp
	 */
	public void setFollowUp(String followUp) {
		this.followUp = followUp;
	}

	/**
	 * @return
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return
	 */
	public String getNotes() {
		return notes;
	}

	/**
	 * @param notes
	 */
	public void setNotes(String notes) {
		this.notes = notes;
	}


    /**
     * @return Returns the statusType.
     */
    public PersonEncounterStatusType getStatusType() {
        return statusType;
    }
    /**
     * @param statusType The statusType to set.
     */
    public void setStatusType(PersonEncounterStatusType statusType) {
        this.statusType = statusType;
    }
    
	/**
	 * @return
	 */
	public String getResult() {
		return result;
	}

	/**
	 * @param result
	 */
	public void setResult(String result) {
		this.result = result;
	}

	/**
	 * @return Returns the job.
	 */
	public Job getJob() {
		return job;
	}
	/**
	 * @param job The job to set.
	 */
	public void setJob(Job job) {
		this.job = job;
	}
	/**
	 * @return Returns the person.
	 */
	public Person getPerson() {
		return person;
	}
	/**
	 * @param person The person to set.
	 */
	public void setPerson(Person person) {
		this.person = person;
	}
	
	/**
	 * @return Returns the referenceId.
	 */
	public String getReferenceId() {
		return referenceId;
	}
	
	/**
	 * @param referenceId The referenceId to set.
	 */
	public void setReferenceId(String referenceId) {
		this.referenceId = referenceId;
	}
	
    /**
	 * @return Returns the domain.
	 */
	public Domain getDomain() {
		return domain;
	}

	/**
	 * @param domain The domain to set.
	 */
	public void setDomain(Domain domain) {
		this.domain = domain;
	}

	public Person getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Person createdBy) {
		this.createdBy = createdBy;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public Person getLastModifiedBy() {
		return lastModifiedBy;
	}

	public void setLastModifiedBy(Person lastModifiedBy) {
		this.lastModifiedBy = lastModifiedBy;
	}

	public Date getLastModifiedDate() {
		return lastModifiedDate;
	}

	public void setLastModifiedDate(Date lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}

	
	public InterviewResultType getResultType() {
		return resultType;
	}

	public void setResultType(InterviewResultType resultType) {
		this.resultType = resultType;
	}

	/**
     * @return Returns the voided.
     */
    public boolean getVoided() {
        return voided;
    }
    /**
     * @param voided The voided to set.
     */
    public void setVoided(boolean voided) {
        this.voided = voided;
    }

	public Person getLeadPerson() {
		return leadPerson;
	}

	public void setLeadPerson(Person leadPerson) {
		this.leadPerson = leadPerson;
	}
    
	@Override
	public String toString() {
		return("id=" + this.id  + "|result=" +this.result + "|resultType={" + this.resultType
				+ "}|status={" + this.statusType + "}|interviewee=" + this.getPerson() + "|interviewer=" + this.getLeadPerson());
	}
	
}
